﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace NewRen.Models.ViewModel
{
    public class vSearchModel
    {
        public int ID { set; get; }

        public string Title { set; get; }

        public string Description { set; get; }

        public string Phone { set; get; }

        public SearchType SearchType { set; get; }

        public string Picture { set; get; }


        public string Url { set; get; }

        public vSearchModel() { }

        public vSearchModel(User model)
        {
            this.ID = model.ID;
            this.Title = model.UserName;
            this.Description = model.Description==null?"":model.Description;
            this.Phone = model.Phone;
            this.SearchType = SearchType.User;
            this.Picture = model.Picture == null ? "/Images/userphoto.png" : "/User/ShowPicture/" + model.ID;
            this.Url = "/User/PersonalShow/" + model.ID;
        }

        public vSearchModel(UserGroup model)
        {
            this.ID = model.ID;
            this.Title = model.GroupName;
            this.Description = model.Description == null ? "" : model.Description;
            this.Phone = model.Phone;
            this.SearchType = SearchType.UserGroup;
            this.Picture = model.Picture==null?"/Images/userphoto.png":"/UserGroup/ShowPicture/" + model.ID;
            this.Url = "/UserGroup/UserGroupShow/" + model.ID;
        }
    }
}
